package com.alan.service.impl;

import com.alan.entity.Music;
import com.alan.entity.MusicList;
import com.alan.entity.RestBean;
import com.alan.mapper.MusicMapper;
import com.alan.service.MusicService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Service
public class MusicServiceImpl implements MusicService {


    @Resource
    private MusicMapper mapper;

    @Override
    public RestBean getAllMusicList() {
         List<MusicList> musicLists = mapper.getAllMusicList();

        if (musicLists==null){
            return RestBean.failure("系统错误，请联系管理员");
        }else
            return RestBean.success(musicLists);
    }

    @Override
    public RestBean getMusicById(Integer id) {
        Music music = mapper.getMusicById(id);

        if (music==null){
            return RestBean.failure("系统错误，请联系管理员");
        }else
            return RestBean.success(music);
    }
}
